<template>
 <div>
  御剑乘风来,除魔天地间!==app
  <hr/>
  <RefCom ref="box"></RefCom>

  <h1 v-if="flag" ref="dom">我是一个h1标签</h1>
  <input type="text" ref="inputDom">

  <button @click="btn">按钮</button>
 </div>
</template>
<script>

import  RefCom  from  './ref/Ref.vue'
export default{
    name:'',
    components:{
      RefCom
    },
    data () {
        return {
          flag:false
        }
    },
    created () {
    },
    computed:{
    },
    methods:{
      btn(){
        this.flag=!this.flag
        // console.log( this.$refs.dom,6666);
        // setTimeout(()=>{
        //   console.log( this.$refs.dom,6666);
        // },3000)
        this.$nextTick(()=>{
          console.log( this.$refs.dom,6666);
        })
      }
    },
    mounted(){
      // this.$refs.box 可以获取子组件的this
      // console.log(this.$refs.box.refMsg,777);
      // this.$refs.box.refHandle()

      console.log(this.$refs,88);
      this.$refs.inputDom.focus()
    }
   
}
</script>
<style lang='less'  scoped>
 
</style>